/*
文件名称：main.c
功能：实现计算器功能
作者：王伟
*/
#include<stdio.h>
#include <stdbool.h>
int main(void)
{
    int a=0;
    int b=0;
    int c=0;
    int op=0;
    char func=0;
    bool quit=false;
    printf("                  *********************************\n");
    printf("\n");
    printf("                         this is a demo   \n");
    printf("                        author:wanngwe@163.com\n");
    printf("\n");
    printf("                  **********************************\n");

    printf("\n");
    printf("\n");
    printf(" Perform basic/special functions, enter 'A/S'!\r\n");

    while(1)
    {
        func=getchar();
       
        if(func=='A')
        {
            func=' ';
            printf("input the first number:\n");
            scanf("%d",&a);
            printf("input the operation:\n");
            getchar();//一定要有这个，清空缓存
            op=getchar();
            printf("input the 2th number:\r\n");
            scanf("%d",&b);
            switch(op)
            {
                case '+':
                    c=a+b;
                    break;
                case '-':
                    c=a-b;
                    break;
                case '*':
                    c=a*b;
                    break;
                case '/':
                    c=a/b;
                    break;
                case 27:
                    quit=true;
                    break;
                default:
                    break;
            }
            printf("the result is：%d\n",c);
        }
        else if(func=='S')
        {


        }
    }
    

   


    while(1)
    {
       
       
        if(quit==true)
            break;
    }
       
   
    
   // system("pause\r\n");
    return 0;
   
}